package com.hex.ds.hdrs.cron.dao;

import com.hex.bigdata.hbda.base.BaseDao;
import com.hex.bigdata.hbda.base.Page;
import com.hex.ds.hdrs.cron.po.CronTask;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @Package: com.hex.ds.hdrs.cron.dao
 * @ClassName CronTaskDao
 * @Description: 定时任务实例表
 * @Author: <gc.zuo>
 * @Date 2021/6/3 15:37
 * @Version v1.0
 **/
@Repository
public class CronTaskDao extends BaseDao {

    /**
     * 分页查询
     *
     * @param map
     * @param page
     * @return
     */
    public List<CronTask> qryJobDefPage(Map<String, String> map, Page page) {
        return this.selectPage(CronTask.class, "com.hex.ds.hdrs.cron.dao.CronTaskDao.qryJobDef", page, map);
    }

    public List<CronTask> qryTaskList(Map map) {
        return this.selectList(CronTask.class, "com.hex.ds.hdrs.cron.dao.CronTaskDao.qryTaskList", map);
    }

    public List<Map> countGroupByExecStatus(Map map) {
        return this.selectList(Map.class, "com.hex.ds.hdrs.cron.dao.CronTaskDao.countGroupByExecStatus", map);
    }

    public List<Map> getTaskListByCruuentApp(Map map) {
        return this.selectList(Map.class, "com.hex.ds.hdrs.cron.dao.CronTaskDao.getTaskListByCruuentApp", map);
    }
    public List<Map> getTaskListByCruuentApp2(Map map) {
        return this.selectList(Map.class, "com.hex.ds.hdrs.cron.dao.CronTaskDao.getTaskListByCruuentApp2", map);
    }
    public List<Map> getTaskListByCruuentApp3(Map map) {
        return this.selectList(Map.class, "com.hex.ds.hdrs.cron.dao.CronTaskDao.getTaskListByCruuentApp3", map);
    }
    public void insertCronTask(CronTask cronTask) {
        this.insert("com.hex.ds.hdrs.cron.dao.CronTaskDao.insert", cronTask);
    }

    public void updateCronTask(CronTask cronTask) {
        this.update("com.hex.ds.hdrs.cron.dao.CronTaskDao.update", cronTask);
    }

    public void deleteByCode(String taskCode) {
        this.delete("com.hex.ds.hdrs.cron.dao.CronTaskDao.deleteByCode", taskCode);
    }

    public Integer countTask(Map paramMap) {
        return this.selectOne(Integer.class, "com.hex.ds.hdrs.cron.dao.CronTaskDao.countTask", paramMap);
    }

    public void delTaskByDate(Map map) {
        this.delete("com.hex.ds.hdrs.cron.dao.CronTaskDao.delTaskByDate", map);
    }

    public void reductionCronTask(String bitchId) {
        this.insert("com.hex.ds.hdrs.cron.dao.CronTaskDao.reductionCronTask", bitchId);
    }

    public List<Map> selectUnionCountByTaskStatus(Map paramMap) {
        return this.selectList(Map.class,"com.hex.ds.hdrs.cron.dao.CronTaskDao.selectUnionCountByTaskStatus",paramMap);
    }
}